{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# **Generate hypothetical YouTube channel growth metrics**"
      ],
      "metadata": {
        "id": "HcmVcnHG9ymr"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Chanin Nantasenamat, Ph.D.\n",
        "\n",
        "[*Data Professor YouTube channel*](https://youtube.com/dataprofessor)"
      ],
      "metadata": {
        "id": "s3S8YpumAMLo"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "nJifRs9P7mDH",
        "outputId": "231d7f5f-8ddb-4fa9-b479-963e67956806"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-18-26e408f636b2>:49: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '[   54.     84.     93.     97.5   129.    190.5   214.5   229.5   285.\n",
            "   259.5   318.    357.    475.5   414.    460.5   459.    481.5   475.5\n",
            "   447.    567.    586.5   648.    694.5   669.    658.5   639.    793.5\n",
            "   640.5   855.    747.    867.    936.   1006.5  1083.    918.    984.\n",
            "   997.5  1186.5  1113.    975.   1168.5  1027.5  1242.   1224.   1429.5\n",
            "  1125.   1485.   1396.5  1287.   1411.5  1570.5  1563.   1633.5  1599.\n",
            "  1837.5  1539.   1674.   1813.5  1857.   1693.5  1693.5  1929.   1969.5\n",
            "  1954.5  1720.5  1944.   2025.   2013.   2091.   1870.5  1885.5  2430.\n",
            "  1696.5  2523.   2224.5  2197.5  2566.5  2910.   2697.   2094.   2325.\n",
            "  1842.   2379.   2494.5  2584.5  2445.   2368.5  2670.   2743.5  2379.\n",
            "  2824.5  2239.5  2598.   2659.5  2967.   2608.5  2820.   2907.   3099.\n",
            "  2767.5  2701.5  2946.   2488.5  2905.5  2905.5  3195.   3316.5  3085.5\n",
            "  3178.5  3502.5  2691.   2926.5  3660.   3166.5  3814.5  3165.   3291.\n",
            "  3664.5  3144.   3964.5  3315.   3438.   3639.   3624.   3649.5  3549.\n",
            "  3810.   3454.5  3000.   3525.   3156.   3679.5  3904.5  4485.   3661.5\n",
            "  3991.5  4005.   4411.5  2767.5  4192.5  3763.5  4222.5  4396.5  3321.\n",
            "  3384.   3147.   4966.5  4369.5  4455.   3585.   3505.5  4690.5  5311.5\n",
            "  4578.   4515.   4876.5  4339.5  4816.5  4017.   4953.   4534.5  4314.\n",
            "  5175.   5097.   4978.5  4941.   4249.5  4819.5  5145.   4185.   4885.5\n",
            "  4021.5  5475.   5004.   4597.5  5502.   4452.   5422.5  4039.5  4936.5\n",
            "  5160.   5130.   5073.   4339.5  5617.5  5430.   5037.   5341.5  5445.\n",
            "  5916.   5515.5  5533.5  4699.5  5574.   6007.5  4797.   6199.5  5113.5\n",
            "  5962.5  6160.5  6060.   5871.   6493.5  6324.   5544.   4794.   6573.\n",
            "  5730.   6343.5  4795.5  5698.5  5704.5  5245.5  5119.5  5754.   5409.\n",
            "  6957.   6972.   5353.5  6886.5  5277.   6550.5  5961.   6052.5  5628.\n",
            "  5785.5  6892.5  6627.   5896.5  6396.   6241.5  7275.   7123.5  6591.\n",
            "  7170.   6256.5  8040.   5511.   7066.5  6639.   6639.   6163.5  6282.\n",
            "  7060.5  6967.5  6550.5  6187.5  8301.   7624.5  6945.   6690.   7275.\n",
            "  8110.5  7495.5  6448.5  7063.5  5823.   8358.   7341.   7284.   8344.5\n",
            "  6922.5  7755.   8100.   5392.5  8143.5  6523.5  7561.5  8112.   8182.5\n",
            "  8833.5  7482.   9040.5  7093.5  8448.   7062.   7408.5  9028.5  6775.5\n",
            "  7543.5  7818.   8391.   8568.   8505.   8058.   7603.5 10090.5  9118.5\n",
            "  7953.   8143.5  7276.5  8226.   8343.   7186.5  9715.5  8140.5  8212.5\n",
            "  8236.5  7920.   9106.5  8754.   7537.5  9153.   8622.   5905.5  8904.\n",
            "  9348.   8152.5  9000.   8644.5  9271.5  8781.   9460.5 10158.   9211.5\n",
            "  8724.   8829.   8241.   9886.5  8107.5  9192.   8688.   9792.   9042.\n",
            "  9663.   6805.5 10084.5 10165.5  8073.   9270.  12279.  10677.   9855.\n",
            "  8811.  10104.   9060.   8394.   9022.5 10261.5 10206.  10570.5  9199.5\n",
            " 10534.5  9891.  11050.5 11424.   9400.5 10086.  11010.   9451.5 10540.5\n",
            "  9759.   8676.   9634.5 10398.   8677.5  9082.5 10008.   9882.  11670.\n",
            "  8832.  11659.5 10590.  10152.  12828.   8185.5 11149.5 13659.  10119.\n",
            " 11241.  12204.  11302.5 12738.  10750.5 13056.   9328.5 12033.  11481.\n",
            " 12493.5 11167.5 11961.   8569.5 11232.  10573.5 10455.  10591.5 11008.5\n",
            " 12748.5  9315.  11260.5  9985.5 11245.5 11706.  11245.5 11071.5 10821.\n",
            " 11821.5 11545.5 10099.5 11413.5 11961.  13282.5 11133.  11355.  11595.\n",
            " 11992.5 12093.  12390.  11124.  12658.5 14305.5 10668.  15127.5 11502.\n",
            " 12700.5 12921.  10317.  11340.  11731.5 11905.5  9603.  11503.5 12660.\n",
            " 11290.5 13164.  11658.  13510.5 11500.5 12648.  12609.  14400.  12243.\n",
            " 12786.  13021.5 12711.  14892.  11344.5 13327.5 13465.5 12981.  11083.5\n",
            " 11994.  12900.  13090.5 13528.5 14253.  10807.5 11079.  13491.  14797.5\n",
            " 14796.  13377.  13815.  13744.5 12565.5 14302.5 14553.  11919.  12759.\n",
            " 13722.  13056.  12399.  13461.  14700.  14196.  11799.  12873.  10329.\n",
            " 14839.5 12583.5 13288.5 13510.5 13000.5 12759.  14044.5 14467.5 12682.5\n",
            " 12298.5 11770.5 10626.  14728.5 13968.  14421.  13822.5 15283.5 13030.5\n",
            " 13275.  11082.  13734.  13621.5 12961.5 13065.  15627.  14458.5 15090.\n",
            " 13726.5 14242.5 16497.  12676.5 13863.  14169.  14623.5 13723.5 13549.5\n",
            " 15885.  17127.  14562.  14992.5 17430.  15055.5 15501.  15262.5 10857.\n",
            " 14215.5 16339.5 12385.5 13683.  15765.  14445.  14554.5 18457.5 13213.5\n",
            " 16635.  14536.5 16854.  13438.5 15048.  16510.5 16111.5 15046.5]' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.\n",
            "  df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] = df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] * 1.5\n",
            "<ipython-input-18-26e408f636b2>:49: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '[   4.5    6.    10.5    9.    18.    15.    21.    21.    27.    30.\n",
            "   34.5   30.    43.5   40.5   43.5   43.5   51.    55.5   57.    52.5\n",
            "   66.    58.5   78.    78.    66.    67.5   70.5   79.5   69.    96.\n",
            "   90.    91.5   85.5   96.    99.   102.   102.    99.   105.   109.5\n",
            "  118.5  106.5  120.   132.   123.   114.   135.   150.   132.   142.5\n",
            "  151.5  141.   172.5  132.   171.   159.   174.   162.   154.5  175.5\n",
            "  153.   163.5  216.   148.5  180.   184.5  187.5  184.5  250.5  193.5\n",
            "  216.   187.5  184.5  234.   243.   210.   178.5  252.   177.   243.\n",
            "  237.   220.5  225.   231.   228.   228.   253.5  258.   232.5  262.5\n",
            "  303.   241.5  228.   225.   300.   270.   271.5  196.5  294.   276.\n",
            "  324.   292.5  298.5  328.5  349.5  313.5  328.5  306.   258.   264.\n",
            "  343.5  313.5  322.5  277.5  307.5  360.   388.5  354.   352.5  393.\n",
            "  363.   355.5  307.5  367.5  348.   387.   378.   369.   361.5  403.5\n",
            "  376.5  414.   397.5  345.   415.5  421.5  390.   450.   429.   409.5\n",
            "  403.5  430.5  451.5  442.5  483.   381.   430.5  469.5  435.   423.\n",
            "  460.5  381.   385.5  451.5  408.   487.5  483.   409.5  462.   522.\n",
            "  471.   433.5  436.5  466.5  496.5  459.   432.   438.   484.5  405.\n",
            "  456.   541.5  472.5  427.5  540.   546.   523.5  562.5  556.5  370.5\n",
            "  486.   457.5  526.5  517.5  478.5  439.5  529.5  526.5  580.5  504.\n",
            "  595.5  508.5  621.   600.   609.   523.5  637.5  484.5  582.   531.\n",
            "  550.5  613.5  565.5  507.   547.5  546.   673.5  618.   573.   559.5\n",
            "  657.   550.5  529.5  642.   603.   687.   583.5  655.5  603.   615.\n",
            "  568.5  621.   714.   559.5  505.5  624.   717.   612.   597.   622.5\n",
            "  727.5  679.5  627.   654.   717.   538.5  681.   586.5  712.5  714.\n",
            "  714.   678.   790.5  724.5  657.   732.   517.5  597.   742.5  744.\n",
            "  648.   658.5  639.   673.5  732.   696.   667.5  694.5  559.5  601.5\n",
            "  792.   591.   640.5  777.   675.   781.5  666.   792.   669.   873.\n",
            "  714.   900.   745.5  837.   717.   826.5  711.   841.5  777.   798.\n",
            "  795.   889.5  892.5  858.   807.   867.   706.5  990.   840.   673.5\n",
            "  834.   945.   952.5  780.   982.5  729.   774.   859.5 1033.5  913.5\n",
            "  651.   870.   984.   808.5  799.5  831.  1027.5  796.5  973.5  894.\n",
            " 1042.5  771.   964.5  648.   955.5  915.   901.5  819.   900.   906.\n",
            "  952.5  847.5 1018.5  813.   898.5  814.5 1059.  1060.5 1095.  1014.\n",
            " 1050.   862.5  958.5  880.5  852.   787.5  864.  1005.   996.   775.5\n",
            " 1045.5  948.   999.  1134.   870.  1059.   984.   990.   880.5 1057.5\n",
            " 1134.  1149.   765.  1168.5  874.5 1051.5  813.   862.5 1074.  1095.\n",
            " 1068.   946.5  846.   970.5 1287.  1080.   961.5 1044.   981.  1140.\n",
            " 1159.5 1167.   915.  1009.5  889.5 1083.   910.5 1263.  1122.   999.\n",
            " 1182.  1086.  1047.   993.  1207.5  951.  1027.5 1144.5 1095.   984.\n",
            " 1161.  1269.  1258.5 1221.  1198.5  970.5 1135.5 1329.  1092.  1153.5\n",
            " 1015.5 1131.  1257.  1321.5 1003.5 1084.5 1264.5 1263.  1158.  1206.\n",
            " 1255.5 1353.  1272.  1257.  1182.  1417.5 1218.  1048.5 1071.  1378.5\n",
            " 1284.  1144.5 1188.  1047.  1221.   997.5 1282.5 1125.  1411.5  963.\n",
            " 1374.  1320.  1131.  1147.5 1339.5 1174.5 1573.5 1231.5 1207.5 1323.\n",
            " 1126.5 1270.5 1209.  1150.5 1429.5 1017.  1243.5 1342.5 1204.5 1446.\n",
            " 1338.  1354.5 1171.5 1369.5 1237.5 1324.5 1540.5 1281.  1378.5 1480.5\n",
            " 1347.  1260.  1590.  1275.  1416.  1357.5 1332.  1431.  1159.5 1483.5\n",
            " 1410.  1255.5 1312.5 1759.5 1435.5 1206.  1317.  1389.  1269.  1453.5\n",
            " 1408.5 1263.  1456.5 1288.5 1353.  1284.  1411.5 1506.  1374.  1492.5\n",
            " 1243.5 1542.  1309.5 1260.  1560.  1311.  1552.5 1611.  1138.5 1255.5\n",
            " 1509.  1404.  1483.5 1230.  1465.5 1474.5 1495.5 1560.  1312.5 1647.\n",
            " 1572.  1492.5 1606.5 1372.5 1384.5 1489.5 1533.  1554.  1353.  1434.\n",
            " 1665.  1488.  1503.  1539.  1372.5 1735.5 1507.5 1459.5 1495.5 1462.5]' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.\n",
            "  df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] = df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] * 1.5\n",
            "<ipython-input-18-26e408f636b2>:49: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '[  1.5   1.5   4.5   4.5   7.5   9.   10.5   9.   13.5  12.   15.   16.5\n",
            "  18.   18.   21.   25.5  24.   22.5  27.   30.   28.5  28.5  34.5  33.\n",
            "  33.   42.   45.   37.5  43.5  40.5  49.5  46.5  36.   43.5  54.   52.5\n",
            "  63.   45.   49.5  54.   48.   55.5  57.   70.5  54.   72.   60.   72.\n",
            "  69.   79.5  70.5  69.   70.5  72.   90.   69.   76.5  75.   70.5  87.\n",
            "  82.5  76.5  85.5  90.   82.5 102.  109.5  75.  103.5 106.5 108.   81.\n",
            "  66.   96.  117.  115.5 102.  126.  117.  121.5 111.  133.5 114.  121.5\n",
            " 105.  118.5 106.5 103.5 126.  127.5 138.  127.5 135.  141.  135.  136.5\n",
            " 147.  123.  150.  157.5 151.5 157.5 147.  184.5 165.  150.  130.5 147.\n",
            " 157.5 151.5 166.5 154.5 145.5 153.  178.5 181.5 178.5 177.  163.5 162.\n",
            " 196.5 156.  180.  184.5 186.  214.5 195.  195.  166.5 235.5 160.5 181.5\n",
            " 157.5 199.5 154.5 181.5 172.5 202.5 211.5 213.  199.5 195.  177.  229.5\n",
            " 174.  217.5 162.  259.5 220.5 220.5 183.  235.5 264.  219.  207.  210.\n",
            " 237.  208.5 226.5 186.  208.5 234.  268.5 252.  282.  232.5 238.5 273.\n",
            " 238.5 231.  184.5 228.  246.  205.5 240.  297.  246.  214.5 220.5 256.5\n",
            " 268.5 258.  220.5 285.  252.  286.5 262.5 295.5 288.  228.  241.5 294.\n",
            " 304.5 285.  244.5 222.  225.  229.5 274.5 282.  309.  310.5 295.5 340.5\n",
            " 300.  271.5 312.  342.  250.5 324.  294.  325.5 324.  279.  289.5 339.\n",
            " 316.5 307.5 331.5 340.5 343.5 333.  298.5 291.  330.  339.  369.  255.\n",
            " 339.  354.  327.  267.  297.  384.  309.  288.  300.  273.  327.  348.\n",
            " 334.5 370.5 325.5 331.5 385.5 336.  355.5 313.5 430.5 384.  406.5 339.\n",
            " 426.  336.  391.5 388.5 315.  430.5 369.  363.  384.  334.5 468.  322.5\n",
            " 423.  319.5 375.  345.  364.5 414.  369.  348.  351.  418.5 394.5 333.\n",
            " 387.  454.5 421.5 394.5 303.  480.  358.5 411.  382.5 415.5 439.5 369.\n",
            " 439.5 397.5 379.5 469.5 507.  382.5 372.  448.5 330.  439.5 372.  399.\n",
            " 402.  433.5 511.5 372.  400.5 487.5 457.5 487.5 426.  378.  441.  466.5\n",
            " 499.5 415.5 367.5 399.  384.  471.  466.5 481.5 541.5 459.  481.5 457.5\n",
            " 513.  442.5 520.5 487.5 522.  459.  477.  439.5 370.5 438.  469.5 465.\n",
            " 441.  601.5 360.  444.  435.  411.  471.  544.5 454.5 423.  553.5 435.\n",
            " 502.5 507.  442.5 525.  582.  504.  486.  546.  585.  502.5 529.5 427.5\n",
            " 528.  454.5 541.5 508.5 456.  600.  529.5 541.5 505.5 580.5 508.5 535.5\n",
            " 576.  550.5 447.  498.  615.  541.5 432.  520.5 607.5 513.  477.  574.5\n",
            " 588.  525.  529.5 610.5 486.  484.5 436.5 531.  606.  627.  582.  447.\n",
            " 580.5 567.  592.5 580.5 490.5 507.  543.  625.5 607.5 532.5 556.5 583.5\n",
            " 463.5 570.  598.5 589.5 535.5 588.  615.  568.5 568.5 648.  589.5 577.5\n",
            " 718.5 628.5 540.  609.  643.5 549.  711.  574.5 600.  540.  588.  621.\n",
            " 750.  642.  555.  607.5 543.  561.  681.  603.  528.  601.5 585.  711.\n",
            " 616.5 610.5 589.5 594.  520.5 634.5 687.  708.  703.5 661.5 630.  582.\n",
            " 751.5 580.5 669.  606.  678.  655.5 682.5 535.5 717.  687.  649.5 654.\n",
            " 612.  694.5 729.  633.  592.5 598.5 765.  645.  651.  597.  685.5 645.\n",
            " 657.  733.5 756.  661.5 781.5 535.5 729.  633.  711.  586.5 694.5 682.5\n",
            " 664.5 661.5 679.5 669.  696.  751.5 726.  730.5 682.5 799.5 696.  736.5\n",
            " 829.5 648.  828.  820.5 700.5 640.5 618.  657.  745.5 661.5 619.5 742.5\n",
            " 780.  738.  673.5 646.5 681.  766.5 708.  643.5 724.5 600.  727.5 603.\n",
            " 826.5 700.5]' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.\n",
            "  df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] = df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] * 1.5\n"
          ]
        }
      ],
      "source": [
        "import pandas as pd\n",
        "import numpy as np\n",
        "from datetime import datetime, timedelta\n",
        "\n",
        "# Set random seed for reproducibility\n",
        "np.random.seed(42)\n",
        "\n",
        "# Generate dates for 2 years\n",
        "start_date = datetime(2019, 8, 19)\n",
        "end_date = datetime(2024, 9, 15)\n",
        "date_range = pd.date_range(start=start_date, end=end_date, freq='D')\n",
        "\n",
        "# Initialize data with zeros\n",
        "n_days = len(date_range)\n",
        "data = {\n",
        "    'DATE': date_range,\n",
        "    'SUBSCRIBERS_GAINED': np.zeros(n_days, dtype=int),\n",
        "    'SUBSCRIBERS_LOST': np.zeros(n_days, dtype=int),\n",
        "    'VIEWS': np.zeros(n_days, dtype=int),\n",
        "    'WATCH_HOURS': np.zeros(n_days, dtype=int),\n",
        "    'LIKES': np.zeros(n_days, dtype=int),\n",
        "    'SHARES': np.zeros(n_days, dtype=int),\n",
        "    'COMMENTS': np.zeros(n_days, dtype=int)\n",
        "}\n",
        "\n",
        "# Create DataFrame\n",
        "df = pd.DataFrame(data)\n",
        "\n",
        "# Function to generate growth\n",
        "def generate_growth(start, end, days):\n",
        "    return np.linspace(start, end, days)\n",
        "\n",
        "# Generate growth patterns\n",
        "subscribers_gained = generate_growth(1, 200, n_days)\n",
        "subscribers_lost = generate_growth(0, 50, n_days)\n",
        "views = generate_growth(10, 10000, n_days)\n",
        "watch_hours = generate_growth(1, 1000, n_days)\n",
        "likes = generate_growth(0, 500, n_days)\n",
        "shares = generate_growth(0, 100, n_days)\n",
        "comments = generate_growth(0, 50, n_days)\n",
        "\n",
        "# Add randomness and ensure integer values\n",
        "for i, col in enumerate(['SUBSCRIBERS_GAINED', 'SUBSCRIBERS_LOST', 'VIEWS', 'WATCH_HOURS', 'LIKES', 'SHARES', 'COMMENTS']):\n",
        "    random_factor = np.random.normal(1, 0.1, n_days)  # Mean of 1, standard deviation of 0.1\n",
        "    df[col] = np.maximum(0, (eval(col.lower()) * random_factor).astype(int))\n",
        "\n",
        "# Weekend boost\n",
        "weekend_mask = (df['DATE'].dt.dayofweek >= 5)\n",
        "df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] = df.loc[weekend_mask, ['VIEWS', 'WATCH_HOURS', 'LIKES']] * 1.5\n",
        "\n",
        "# Seasonal variation (higher in summer)\n",
        "days_in_year = 366  # Account for leap year\n",
        "summer_boost = np.sin(np.linspace(0, 2*np.pi, days_in_year))\n",
        "df['VIEWS'] = df['VIEWS'] * (1 + 0.2 * summer_boost[df['DATE'].dt.dayofyear - 1])\n",
        "\n",
        "# Occasional viral videos (once every 2 months on average, starting from the second month)\n",
        "viral_days = np.random.choice(range(30, n_days), size=11, replace=False)\n",
        "df.loc[viral_days, ['VIEWS', 'LIKES', 'SHARES', 'COMMENTS']] = df.loc[viral_days, ['VIEWS', 'LIKES', 'SHARES', 'COMMENTS']] * 5\n",
        "\n",
        "# Ensure integer values\n",
        "for col in df.columns:\n",
        "    if col != 'DATE':\n",
        "        df[col] = df[col].astype(int)\n",
        "\n",
        "# Calculate cumulative subscribers\n",
        "df['TOTAL_SUBSCRIBERS'] = (df['SUBSCRIBERS_GAINED'] - df['SUBSCRIBERS_LOST']).cumsum()\n",
        "\n",
        "# Ensure no negative values\n",
        "df[df.select_dtypes(include=[np.number]).columns] = df.select_dtypes(include=[np.number]).clip(lower=0)\n",
        "\n",
        "# Save to CSV\n",
        "df.to_csv('youtube_channel_data.csv', index=False)"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# Display DataFrame\n",
        "df"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 424
        },
        "id": "aA-ufsfd8LAg",
        "outputId": "73f6bd35-ecb2-4bc0-f54f-6dde16dc7abf"
      },
      "execution_count": 19,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "           DATE  SUBSCRIBERS_GAINED  SUBSCRIBERS_LOST  VIEWS  WATCH_HOURS  \\\n",
              "0    2019-08-19                   1                 0      6            1   \n",
              "1    2019-08-20                   1                 0     11            1   \n",
              "2    2019-08-21                   1                 0     17            2   \n",
              "3    2019-08-22                   1                 0     16            2   \n",
              "4    2019-08-23                   1                 0     28            2   \n",
              "...         ...                 ...               ...    ...          ...   \n",
              "1850 2024-09-11                 186                51   7250          821   \n",
              "1851 2024-09-12                 235                47   8068         1076   \n",
              "1852 2024-09-13                 175                56   7578          907   \n",
              "1853 2024-09-14                 218                52  13022         1495   \n",
              "1854 2024-09-15                 220                50  12147         1462   \n",
              "\n",
              "      LIKES  SHARES  COMMENTS  TOTAL_SUBSCRIBERS  \n",
              "0         0       0         0                  1  \n",
              "1         0       0         0                  2  \n",
              "2         0       0         0                  3  \n",
              "3         0       0         0                  4  \n",
              "4         0       0         0                  5  \n",
              "...     ...     ...       ...                ...  \n",
              "1850    573     108        43             140393  \n",
              "1851    563      89        49             140581  \n",
              "1852    449      89        45             140700  \n",
              "1853    826      92        53             140866  \n",
              "1854    700     109        54             141036  \n",
              "\n",
              "[1855 rows x 9 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-1b345df9-27e8-45de-89a4-3d3dc8fc06c3\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>DATE</th>\n",
              "      <th>SUBSCRIBERS_GAINED</th>\n",
              "      <th>SUBSCRIBERS_LOST</th>\n",
              "      <th>VIEWS</th>\n",
              "      <th>WATCH_HOURS</th>\n",
              "      <th>LIKES</th>\n",
              "      <th>SHARES</th>\n",
              "      <th>COMMENTS</th>\n",
              "      <th>TOTAL_SUBSCRIBERS</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>2019-08-19</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>6</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2019-08-20</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>11</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>2019-08-21</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>17</td>\n",
              "      <td>2</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>2019-08-22</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>16</td>\n",
              "      <td>2</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>4</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>2019-08-23</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>28</td>\n",
              "      <td>2</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>5</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1850</th>\n",
              "      <td>2024-09-11</td>\n",
              "      <td>186</td>\n",
              "      <td>51</td>\n",
              "      <td>7250</td>\n",
              "      <td>821</td>\n",
              "      <td>573</td>\n",
              "      <td>108</td>\n",
              "      <td>43</td>\n",
              "      <td>140393</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1851</th>\n",
              "      <td>2024-09-12</td>\n",
              "      <td>235</td>\n",
              "      <td>47</td>\n",
              "      <td>8068</td>\n",
              "      <td>1076</td>\n",
              "      <td>563</td>\n",
              "      <td>89</td>\n",
              "      <td>49</td>\n",
              "      <td>140581</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1852</th>\n",
              "      <td>2024-09-13</td>\n",
              "      <td>175</td>\n",
              "      <td>56</td>\n",
              "      <td>7578</td>\n",
              "      <td>907</td>\n",
              "      <td>449</td>\n",
              "      <td>89</td>\n",
              "      <td>45</td>\n",
              "      <td>140700</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1853</th>\n",
              "      <td>2024-09-14</td>\n",
              "      <td>218</td>\n",
              "      <td>52</td>\n",
              "      <td>13022</td>\n",
              "      <td>1495</td>\n",
              "      <td>826</td>\n",
              "      <td>92</td>\n",
              "      <td>53</td>\n",
              "      <td>140866</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1854</th>\n",
              "      <td>2024-09-15</td>\n",
              "      <td>220</td>\n",
              "      <td>50</td>\n",
              "      <td>12147</td>\n",
              "      <td>1462</td>\n",
              "      <td>700</td>\n",
              "      <td>109</td>\n",
              "      <td>54</td>\n",
              "      <td>141036</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>1855 rows × 9 columns</p>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1b345df9-27e8-45de-89a4-3d3dc8fc06c3')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-1b345df9-27e8-45de-89a4-3d3dc8fc06c3 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-1b345df9-27e8-45de-89a4-3d3dc8fc06c3');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-513a9238-f381-4e72-aba7-295fb9d04368\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-513a9238-f381-4e72-aba7-295fb9d04368')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-513a9238-f381-4e72-aba7-295fb9d04368 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "  <div id=\"id_9673b2a4-c2bd-414b-abd1-c590f8c7d3a6\">\n",
              "    <style>\n",
              "      .colab-df-generate {\n",
              "        background-color: #E8F0FE;\n",
              "        border: none;\n",
              "        border-radius: 50%;\n",
              "        cursor: pointer;\n",
              "        display: none;\n",
              "        fill: #1967D2;\n",
              "        height: 32px;\n",
              "        padding: 0 0 0 0;\n",
              "        width: 32px;\n",
              "      }\n",
              "\n",
              "      .colab-df-generate:hover {\n",
              "        background-color: #E2EBFA;\n",
              "        box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "        fill: #174EA6;\n",
              "      }\n",
              "\n",
              "      [theme=dark] .colab-df-generate {\n",
              "        background-color: #3B4455;\n",
              "        fill: #D2E3FC;\n",
              "      }\n",
              "\n",
              "      [theme=dark] .colab-df-generate:hover {\n",
              "        background-color: #434B5C;\n",
              "        box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "        filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "        fill: #FFFFFF;\n",
              "      }\n",
              "    </style>\n",
              "    <button class=\"colab-df-generate\" onclick=\"generateWithVariable('df')\"\n",
              "            title=\"Generate code using this dataframe.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M7,19H8.4L18.45,9,17,7.55,7,17.6ZM5,21V16.75L18.45,3.32a2,2,0,0,1,2.83,0l1.4,1.43a1.91,1.91,0,0,1,.58,1.4,1.91,1.91,0,0,1-.58,1.4L9.25,21ZM18.45,9,17,7.55Zm-12,3A5.31,5.31,0,0,0,4.9,8.1,5.31,5.31,0,0,0,1,6.5,5.31,5.31,0,0,0,4.9,4.9,5.31,5.31,0,0,0,6.5,1,5.31,5.31,0,0,0,8.1,4.9,5.31,5.31,0,0,0,12,6.5,5.46,5.46,0,0,0,6.5,12Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "    <script>\n",
              "      (() => {\n",
              "      const buttonEl =\n",
              "        document.querySelector('#id_9673b2a4-c2bd-414b-abd1-c590f8c7d3a6 button.colab-df-generate');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      buttonEl.onclick = () => {\n",
              "        google.colab.notebook.generateWithVariable('df');\n",
              "      }\n",
              "      })();\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "dataframe",
              "variable_name": "df",
              "summary": "{\n  \"name\": \"df\",\n  \"rows\": 1855,\n  \"fields\": [\n    {\n      \"column\": \"DATE\",\n      \"properties\": {\n        \"dtype\": \"date\",\n        \"min\": \"2019-08-19 00:00:00\",\n        \"max\": \"2024-09-15 00:00:00\",\n        \"num_unique_values\": 1855,\n        \"samples\": [\n          \"2020-04-08 00:00:00\",\n          \"2020-11-11 00:00:00\",\n          \"2022-12-01 00:00:00\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"SUBSCRIBERS_GAINED\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 58,\n        \"min\": 1,\n        \"max\": 235,\n        \"num_unique_values\": 225,\n        \"samples\": [\n          10,\n          202,\n          123\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"SUBSCRIBERS_LOST\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 14,\n        \"min\": 0,\n        \"max\": 61,\n        \"num_unique_values\": 60,\n        \"samples\": [\n          0,\n          5,\n          36\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"VIEWS\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 4698,\n        \"min\": 6,\n        \"max\": 64777,\n        \"num_unique_values\": 1731,\n        \"samples\": [\n          3779,\n          7184,\n          3943\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"WATCH_HOURS\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 365,\n        \"min\": 1,\n        \"max\": 1759,\n        \"num_unique_values\": 979,\n        \"samples\": [\n          227,\n          561,\n          199\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"LIKES\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 220,\n        \"min\": 0,\n        \"max\": 3367,\n        \"num_unique_values\": 619,\n        \"samples\": [\n          48,\n          696,\n          106\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"SHARES\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 34,\n        \"min\": 0,\n        \"max\": 495,\n        \"num_unique_values\": 123,\n        \"samples\": [\n          17,\n          43,\n          41\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"COMMENTS\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 17,\n        \"min\": 0,\n        \"max\": 290,\n        \"num_unique_values\": 68,\n        \"samples\": [\n          170,\n          13,\n          4\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"TOTAL_SUBSCRIBERS\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 42152,\n        \"min\": 1,\n        \"max\": 141036,\n        \"num_unique_values\": 1855,\n        \"samples\": [\n          2441,\n          8651,\n          59666\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}"
            }
          },
          "metadata": {},
          "execution_count": 19
        }
      ]
    }
  ]
}